package com.dungeon.game;

import java.util.HashMap;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;

public class GameImage {

	public enum image_types{IT_BASIC,IT_SMALL,IT_TINY,IT_GREEN,IT_DARK,IT_WHITE,IT_GREY,IT_RED};
	HashMap<image_types,Bitmap> i;

	public GameImage() {
		i = new HashMap<image_types,Bitmap>();
	}

	public void add(image_types it, Bitmap b){
		i.put(it,b);
	}

	public Bitmap get(image_types it){
		if (i.get(it)==null){
			if (it==image_types.IT_BASIC){
				return Bitmap.createBitmap(96,96,Bitmap.Config.ARGB_8888);
			} else {
				return get(image_types.IT_BASIC);
			}
		} else {
			return (Bitmap)i.get(it);
		}
	}

	static GameImage make_singlecolor_overlay(int a,int r,int g,int b){
	    GameImage gi = new GameImage();
	    Bitmap bmp = Bitmap.createBitmap(96,96,Bitmap.Config.ARGB_8888);
	    bmp.eraseColor(Color.argb(a,r,g,b));
	    gi.add(image_types.IT_BASIC,bmp);
	    return gi;
	}

	static GameImage make_frame_overlay(int r, int g, int b){
	    GameImage gi = new GameImage();
	    Bitmap bmp = Bitmap.createBitmap(96,96,Bitmap.Config.ARGB_8888);
	    bmp.eraseColor(Color.argb(0,0,0,0));
	    Canvas canvas = new Canvas(bmp);
	    Paint paint = new Paint();
	    paint.setColor(Color.argb(255,r,g,b));
	    paint.setStyle(Paint.Style.STROKE);
        paint.setStrokeWidth(1);
        canvas.drawRect(0,0,95,95, paint);
	    gi.add(image_types.IT_BASIC,bmp);
	    return gi;
	}
}
